<template>
  <div>
    <!-- :title="type == 1 ? '开户审核' : type == 2 ? '入金审核' : '现场见面'" -->
    <el-dialog
      :close-on-click-modal="false"
      :before-close="cancel"
      :visible="visible"
      :title="
        type == 1
          ? $t('openCheck.openCheck15')
          : type == 2
          ? $t('openCheck.openCheck16')
          : $t('openCheck.openCheck17')
      "
      width="950px"
    >
      <div>
        <el-form ref="ruleForm" :model="ruleForm" label-width="150px">
          <div class="Bcontent">
            <h3>{{$t('openCheck.openCheck30')}}</h3>
            <div class="f-cb" v-if="ruleForm.info">
              <el-col :span="12">
                  <text-tag
                  :value="ruleForm.info.country_code"
                  :labelRuleValue="{title:$t('vip.vip13')}"
                  :disabledValue="true"
                ></text-tag>
              </el-col>
              <el-col :span="12">
                  <text-tag
                  :value="ruleForm.info.account"
                  :labelRuleValue="{title:$t('vip.vip1')}"
                  :disabledValue="true"
                ></text-tag>
              </el-col>
              <el-col :span="12">
                  <text-tag
                  :value="ruleForm.info.nickname"
                  :labelRuleValue="{title:$t('vip.vip2')}"
                  :disabledValue="true"
                ></text-tag>
              </el-col>
              <el-col :span="12">
                <el-form-item :label="$t('openCheck.openCheck1')">
                    <el-select
                    :value="String(ruleForm.info.type)"
                    :disabled="true"
                    clearable
                  >
                    <el-option
                      v-for="(item, index) in accountOption"
                      :key="index"
                      :value="String(item.id)"
                      :label="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item> 
              </el-col>
              <el-col :span="12">
                <el-form-item :label="$t('openCheck.openCheck3')">
                    <el-select
                    :value="String(ruleForm.info.user_type)"
                    :disabled="true"
                    clearable
                  >
                    <el-option
                      v-for="(item, index) in cardMode"
                      :key="index"
                      :value="String(item.id)"
                      :label="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item> 
              </el-col>
            </div>
          </div>
          <div
            class="Bcontent"
            v-for="(Bitem, Bindex) in ruleForm.page"
            :key="Bindex"
          >
            <!-- v-show="ruleForm.data['page_' + Bitem.id]" -->
            <h3>{{ Bitem["name_" + $store.state.settings.langTail] }}</h3>
            <div
              v-for="(item, index) in Bitem.fields"
              :key="index"
              class="f-cb"
            >
              <el-col
                :span="12"
                v-if="
                  (item.type == 'input' ||
                    (item.type == 'input-images' &&
                      ruleForm.data['page_' + Bitem.id] &&
                      ruleForm.data['page_' + Bitem.id][item.name] &&
                      isImg(ruleForm.data['page_' + Bitem.id][item.name]) ==
                        'input')) &&
                  formShow(Bitem.id, item.name)
                "
              >
                <text-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                ></text-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="item.type == 'select' && formShow(Bitem.id, item.name)"
              >
                <select-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                    content: item.options ? item.options : [],
                  }"
                  :disabledValue="true"
                ></select-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="item.type == 'switch' && formShow(Bitem.id, item.name)"
              >
                <single-check-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                ></single-check-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="item.type == 'radio' && formShow(Bitem.id, item.name)"
              >
                <radio-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                    content: item.options ? item.options : [],
                  }"
                  :disabledValue="true"
                ></radio-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="item.type == 'checkbox' && formShow(Bitem.id, item.name)"
              >
                <check-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id] &&
                    ruleForm.data['page_' + Bitem.id][item.name]
                      ? ruleForm.data['page_' + Bitem.id][item.name].split(',')
                      : []
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                    content: item.options ? item.options : [],
                  }"
                  :disabledValue="true"
                ></check-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="
                  (item.type == 'date' || item.type == 'datetime') &&
                  formShow(Bitem.id, item.name)
                "
              >
                <!-- <date-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                  :dateType="item"
                ></date-tag> -->
                <text-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                ></text-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="
                  (item.type == 'upload' ||
                    item.type == 'identCards' ||
                    (item.type == 'input-images' &&
                      ruleForm.data['page_' + Bitem.id] &&
                      ruleForm.data['page_' + Bitem.id][item.name] &&
                      isImg(ruleForm.data['page_' + Bitem.id][item.name]) ==
                        'image')) &&
                  formShow(Bitem.id, item.name)
                "
              >
                <upload-tag
                  :arrayBoll="true"
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                ></upload-tag>
              </el-col>
              <el-col
                :span="12"
                v-if="item.type == 'video' && formShow(Bitem.id, item.name)"
              >
                <video-tag
                  :value="
                    ruleForm.data['page_' + Bitem.id]
                      ? ruleForm.data['page_' + Bitem.id][item.name]
                      : ''
                  "
                  :labelRuleValue="{
                    title: item['title_' + $store.state.settings.langTail],
                  }"
                  :disabledValue="true"
                ></video-tag>
              </el-col>
              <!-- <el-col :span="12" v-if="item.type == 'row'"> -->
              <row-tag
                v-if="
                  item.type == 'row' &&
                  ruleForm.data['page_' + Bitem.id] &&
                  isShowRow(ruleForm.data['page_' + Bitem.id], item, Bitem)
                "
                :ruleForm="ruleForm"
                :Bitem="Bitem"
                :labelRuleValue="item.container"
                :disabledValue="true"
              ></row-tag>
              <!-- </el-col> -->
            </div>
          </div>
        </el-form>
        <!-- 待完善状态 不展示 -->
        <el-form
          v-if="ruleSubForm.open_status != 5"
          ref="ruleSubForm"
          class="shenheForm"
          :model="ruleSubForm"
          label-width="130px"
        >
          <!-- 审核结果 -->
          <h3>{{$t("openCheck.openCheck18")}}</h3>
          <el-form-item>
            <!-- 通过 -->
            <el-button
              type="primary"
              :plain="
                agreeBtn == 1 || [2,6].includes(ruleSubForm.open_status)? false : true
              "
              :disabled="ruleSubForm.open_status != 3"
              icon="el-icon-check"
              @click="clickAgree"
              >{{$t("openCheck.openCheck19")}}</el-button
            >
            <!-- 驳回 -->
            <el-button
              type="danger"
              :plain="
                agreeBtn == 2 || ruleSubForm.open_status == '4' ? false : true
              "
              :disabled="ruleSubForm.open_status != 3"
              icon="el-icon-close"
              @click="clickRejest"
              >{{$t("openCheck.openCheck20")}}</el-button
            >
          </el-form-item>
          <el-col
            :span="12"
            v-if="agreeBtn == 1 || ruleSubForm.open_status == '2' ||ruleSubForm.open_status == '6' "
          >
            <!-- 证券账号 -->
            <el-form-item
              :label="$t('openCheck.openCheck21')"
              prop="ZhengJuanAccount"
              :rules="{
                required: true,
                message:
                  $t('openCheck.openCheck21') + $t('openCheck.openCheck25'),
                trigger: 'blur',
                pattern: /^[0-9]\d{7}$/,
              }"
            >
              <el-input
                v-if="ruleSubForm.open_status != 3"
                disabled
                v-model="ruleSubForm.securities_account"
              />
              <el-input
                v-else
                v-model="ruleSubForm.ZhengJuanAccount"
                @input="changeAccount"
                maxlength="8"
                show-word-limit
              />
            </el-form-item>
          </el-col>
          <div
            class="checkContent"
            v-if="agreeBtn == 2 || ruleSubForm.open_status == '4'"
          >
            <div
              v-for="(domain, index) in ruleSubForm.fail_info"
              :key="index"
              class="contentAdd"
            >
              <!-- 驳回步骤 -->
              <el-col :span="11">
                <el-form-item
                  :label="$t('openCheck.openCheck22')"
                  :prop="'fail_info.' + index + '.page_id'"
                  :rules="{
                    required: true,
                    message:
                      $t('openCheck.openCheck22') + $t('common.common33'),
                    trigger: 'change',
                  }"
                >
                  <el-select
                    :disabled="ruleSubForm.open_status != 3"
                    v-model="domain.page_id"
                    @change="disReason"
                    :placeholder="
                      $t('common.common27') + $t('openCheck.openCheck22')
                    "
                  >
                    <el-option
                      v-for="(item, index) in ruleForm.page"
                      :key="index"
                      :disabled="item.disabled"
                      :label="item['name_' + $store.state.settings.langTail]"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <!-- 驳回原因 -->
              <el-col :span="11">
                <el-form-item
                  :label="$t('openCheck.openCheck23')"
                  :prop="'fail_info.' + index + '.listID'"
                  :rules="{
                    required: true,
                    message:
                      $t('openCheck.openCheck23') + $t('common.common33'),
                    trigger: 'change',
                  }"
                >
                  <el-input
                    v-if="ruleSubForm.open_status == '4'"
                    disabled
                    type="textarea"
                    autosize
                    v-model="domain.Reastring"
                  ></el-input>
                  <el-select
                    v-else
                    v-model="domain.listID"
                    multiple
                    collapse-tags
                    filterable
                    popper-class="rejectReason"
                    :placeholder="
                      $t('common.common27') + $t('openCheck.openCheck23')
                    "
                  >
                    <el-option
                      v-for="(item, index) in reasonList"
                      :key="index"
                      :label="item['title_' + $store.state.settings.langTail]"
                      :value="item.id"
                    >
                      <span
                        style="
                          float: left;
                          max-width: 70%;
                          overflow: hidden;
                          text-overflow: ellipsis;
                          white-space: nowrap;
                        "
                        >{{
                          item["title_" + $store.state.settings.langTail]
                        }}</span
                      >
                      <span
                        @click="delReason($event, item.id)"
                        style="
                          float: right;
                          color: #8492a6;
                          font-size: 13px;
                          display: inline-block;
                          width: 30px;
                          text-align: center;
                        "
                        >x</span
                      >
                    </el-option>
                  </el-select>
                  <el-button
                    v-show="index == 0 && agreeBtn == 2"
                    class="operBtn"
                    icon="el-icon-plus"
                    type="primary"
                    circle
                    @click="addReason"
                  />
                  <el-button
                    v-show="index != 0 && agreeBtn == 2"
                    class="operBtn"
                    type="danger"
                    icon="el-icon-delete"
                    circle
                    @click.prevent="removeDomain(domain)"
                  />
                </el-form-item>
              </el-col>
            </div>
            <span v-show="agreeBtn == 2" @click="addDomain"
              >+ {{ $t("openCheck.openCheck24") }}</span
            >
          </div>
        </el-form>
        <!-- 账户升级 -->
        <el-form 
          v-if="(ruleSubForm.type == 2&&ruleSubForm.open_status == 6) || ruleSubForm.is_upgrade == 1"
          ref="ruleSubForm"
          class="shenheForm"
          :model="ruleSubForm"
          label-width="130px">
          <h3>{{$t("commonjs.commonjs30")}}</h3>
          <el-form-item>
            <!-- 通过 -->
            <el-button
              type="primary"
              :plain="
                AccountBtn == 1 || ruleSubForm.upgrade_status == 1? false : true
              "
              icon="el-icon-check"
              :disabled="ruleSubForm.open_status != 6"
              @click="clickAccountTrue"
              >{{$t("openCheck.openCheck19")}}</el-button
            >
            <!-- 驳回 -->
            <el-button
              type="danger"
              :plain="
                AccountBtn == 2 || ruleSubForm.upgrade_status == 2? false : true
              "
              :disabled="ruleSubForm.open_status != 6"
              icon="el-icon-close"
              @click="clickAccountFalse"
              >{{$t("openCheck.openCheck20")}}</el-button
            >
          </el-form-item>
          <el-col
            :span="12"
            v-if="AccountBtn == 1 || ruleSubForm.upgrade_status ==1"
          >
            <!-- 账户类型 -->
            <el-form-item
              :label="$t('openCheck.openCheck1')"
              prop="ZhengJuanAccount">
              <el-input
                disabled
                :value="$t('commonjs.commonjs6')"
              />
            </el-form-item>
          </el-col>
        </el-form>
      </div>
      <div
        slot="footer"
        class="dialog-footer"
      >
        
        <el-button type="info" plain @click="cancel"  
        v-show="ruleSubForm.open_status == 3 || (ruleSubForm.open_status == 6 && ruleSubForm.type == 2)"
        v-if="
        (checkPermission(['openCheck@update']) && type == 1) ||
        (checkPermission(['payment@update']) && type == 2) ||
        (checkPermission(['appointment@update']) && type == 3)">
          {{ $t("common.common1") }}
        </el-button>
          <el-button
            :loading="submitLoading"
            type="primary"
            plain
            @click="submit('ruleSubForm')"
            v-show="ruleSubForm.open_status == 3 || (ruleSubForm.open_status == 6 && ruleSubForm.type == 2)"
        v-if="
        (checkPermission(['openCheck@update']) && type == 1) ||
        (checkPermission(['payment@update']) && type == 2) ||
        (checkPermission(['appointment@update']) && type == 3)"
        >
          {{ $t("common.common2") }}
        </el-button>
        
        <el-button
          type="primary"
          plain
          v-show="ruleSubForm.open_status == 2"
          @click="exportPageLink"
        >
          {{ $t("common.common43") }}
        </el-button>
      </div>
    </el-dialog>
    <add-reason ref="add_reason" />
  </div>
</template>
<script>
import {
  CusInfo,
  updateItem,
  reasonList,
  deleteItem,
  accountUp,
} from "@/api/openList/openCheck";
import { CusInfo1, updateItem1,accountUp1 } from "@/api/openList/cashCheck";
import { CusInfo2, updateItem2,accountUp2 } from "@/api/openList/meetSite";
import AddReason from "./add_reason";
import TextTag from "@/components/typeTag/TextTag";
import SelectTag from "@/components/typeTag/SelectTag";
import SingleCheckTag from "@/components/typeTag/SingleCheckTag";
import RadioTag from "@/components/typeTag/RadioTag";
import CheckTag from "@/components/typeTag/CheckTag";
import DateTag from "@/components/typeTag/DateTag";
import UploadTag from "@/components/typeTag/UploadTag";
import VideoTag from "@/components/typeTag/VideoTag";
import RowTag from "@/components/typeTag/RowTag";
import {
  accountOption,
  cardMode,
} from "@/assets/js/common";
export default {
  components: {
    AddReason,
    TextTag,
    SelectTag,
    SingleCheckTag,
    RadioTag,
    CheckTag,
    DateTag,
    UploadTag,
    VideoTag,
    RowTag,
  },
  props: {
    type: {
      type: Number, //type:1 开户审核  2:入金审核  3:现场见面
    },
  },
  data() {
    return {
      accountOption,
      cardMode,
      rowID: "",
      visible: false,
      submitLoading: false,
      agreeBtn: 0, //1 通过  2驳回
      AccountBtn:0,//账户升级  1 通过  2驳回
      ruleForm: {},
      reasonList: [],
      ruleSubForm: {
        fail_info: [
          {
            page_id: "",
            listID: [],
          },
        ],
      },
    };
  },
  methods: {
    //导出pdf跳转
    exportPageLink(){
      window.open('#/export')
    },
    init(rowID) {
      localStorage.setItem('export_data',JSON.stringify({type:this.type,rowID:rowID}))
      this.getReasonList();
      this.getInfo(rowID);
    },
    getInfo(rowID) {
      if (this.type == 1) {
        CusInfo(rowID)
          .then((res) => {
            if (res.code == 10000) {
              this.rowID = rowID;
              this.ruleForm = res.data;
              this.ruleSubForm = res.data.info;
              res.data.info.fail_info.forEach((item) => {
                item.listID = item.list;
                if (item.list.length != 0) {
                  let Reastring = "";
                  item.list.forEach((key, index) => {
                    if (index != item.list.length - 1) {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail] +
                        "，";
                    } else {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail];
                    }
                  });
                  item.Reastring = Reastring;
                }
              });
              if (
                (res.data.info && res.data.info.fail_info.length == 0) ||
                res.data.info.open_status == 3
              ) {
                this.ruleSubForm.fail_info = [
                  {
                    page_id: "",
                    listID: [],
                  },
                ];
              }
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 1E10)
                 this.MathRand()
              ); //随机生成8位数字（证券账户）
              this.visible = true;
            } else {
              this.$message.error(res.message);
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      } else if (this.type == 2) {
        CusInfo1(rowID)
          .then((res) => {
            if (res.code == 10000) {
              this.rowID = rowID;
              this.ruleForm = res.data;
              this.ruleSubForm = res.data.info;
              res.data.info.fail_info.forEach((item) => {
                item.listID = item.list;
                if (item.list.length != 0) {
                  let Reastring = "";
                  item.list.forEach((key, index) => {
                    if (index != item.list.length - 1) {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail] +
                        "，";
                    } else {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail];
                    }
                  });
                  item.Reastring = Reastring;
                }
              });
              if (
                (res.data.info && res.data.info.fail_info.length == 0) ||
                res.data.info.open_status == 3
              ) {
                this.ruleSubForm.fail_info = [
                  {
                    page_id: "",
                    listID: [],
                  },
                ];
              }
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 1E10)
                this.MathRand()
              ); //随机生成8位数字（证券账户）
              this.visible = true;
            } else {
              this.$message.error(res.message);
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      } else if (this.type == 3) {
        CusInfo2(rowID)
          .then((res) => {
            if (res.code == 10000) {
              this.rowID = rowID;
              this.ruleForm = res.data;
              this.ruleSubForm = res.data.info;
              res.data.info.fail_info.forEach((item) => {
                item.listID = item.list;
                if (item.list.length != 0) {
                  let Reastring = "";
                  item.list.forEach((key, index) => {
                    if (index != item.list.length - 1) {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail] +
                        "，";
                    } else {
                      Reastring +=
                        key["reason_" + this.$store.state.settings.langTail];
                    }
                  });
                  item.Reastring = Reastring;
                }
              });
              if (
                (res.data.info && res.data.info.fail_info.length == 0) ||
                res.data.info.open_status == 3
              ) {
                this.ruleSubForm.fail_info = [
                  {
                    page_id: "",
                    listID: [],
                  },
                ];
              }
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 1E10)
                 this.MathRand()
              ); //随机生成8位数字（证券账户）
              this.visible = true;
            } else {
              this.$message.error(res.message);
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      }
    },
    getReasonList() {
      reasonList()
        .then((res) => {
          if (res.code == 10000) {
            this.reasonList = res.data;
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((error) => {
          this.$message.error(error.Error);
        });
    },
    MathRand(){
      var Num = "";
      for(var i=0;i<8;i++){
        Num += Math.floor(Math.random()*10);
      }
      return Num
    },
    // 选过的 驳回步骤不能重复选择
    disReason(val) {
      this.ruleForm.page.forEach((item) => {
        item.disabled = false;
      });
      for (var i = 0; i < this.ruleSubForm.fail_info.length; i++) {
        for (var j = 0; j < this.ruleForm.page.length; j++) {
          if (
            this.ruleSubForm.fail_info[i].page_id == this.ruleForm.page[j].id
          ) {
            this.ruleForm.page[j].disabled = true;
          }
        }
      }
    },
    cancel() {
      this.visible = false;
      this.agreeBtn = 0;
      this.AccountBtn = 0;
      this.ruleForm = {};
    },
    addDomain() {
      this.ruleSubForm.fail_info.push({
        page_id: "",
        listID: [],
      });
    },
    removeDomain(item) {
      var index = this.ruleSubForm.fail_info.indexOf(item);
      if (index !== -1) {
        this.ruleSubForm.fail_info.splice(index, 1);
      }
      // 删除后 驳回步骤可选择
      if (item.page_id != "") {
        for (var j = 0; j < this.ruleForm.page.length; j++) {
          if (item.page_id == this.ruleForm.page[j].id) {
            this.ruleForm.page[j].disabled = false;
          }
        }
      }
    },
    addReason() {
      this.$refs.add_reason.init();
    },
    submit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // 是否确认提交
          this.$confirm(this.$t("common.common29"), this.$t("common.common5"), {
            confirmButtonText: this.$t("common.common2"),
            cancelButtonText: this.$t("common.common1"),
            type: "warning",
          })
            .then(() => {
              this.submitLoading = true;
              //判断是不是账户升级状态和账户类型是标准账户
              if(this.ruleSubForm.open_status == 6 && this.ruleSubForm.type == 2){
                this.accountUpgrade()
              }else{
                this.ruleSubForm.fail_info.forEach((item) => {
                  item.list = [];
                  item.listID.forEach((key, index) => {
                    this.reasonList.forEach((reasonItem) => {
                      if (reasonItem.id == key) {
                        item.list.push({
                          reason_zh: reasonItem.title_zh,
                          reason_en: reasonItem.title_en,
                          reason_tc: reasonItem.title_tc,
                        });
                      }
                    });
                  });
                });
                this.Update();
              }
              
            })
            .catch(() => {});
        }
      });
    },
    Update() {
      let verification = false;
      this.ruleSubForm.fail_info.forEach((ReasonData, ReaIndex) => {
        this.ruleForm.page.forEach((pageData, pageIndex) => {
          if (
            ReasonData.page_id == pageData.id &&
            pageData.url_path.indexOf("verification") != -1
          ) {
            //包含'verification'字段，既(汇款通知，预约见面，汇款通知+预约见面的一个  即为 true)
            verification = true;
          }
        });
      });

      if (this.type == 1) {
        updateItem(this.rowID, {
          id: this.rowID,
          type: this.agreeBtn,
          securities_account: this.ruleSubForm.ZhengJuanAccount,
          reason: this.ruleSubForm.fail_info,
          verification: verification,
        })
          .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            } else if (res.code == -10000) {
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 1E10)
                this.MathRand()
              ); //随机生成8位数字（证券账户）
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      } else if (this.type == 2) {
        updateItem1(this.rowID, {
          id: this.rowID,
          type: this.agreeBtn,
          securities_account: this.ruleSubForm.ZhengJuanAccount,
          reason: this.ruleSubForm.fail_info,
          verification: verification,
        })
          .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            } else if (res.code == -10000) {
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 100000000)
                this.MathRand()
              ); //随机生成8位数字（证券账户）
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      } else if (this.type == 3) {
        updateItem2(this.rowID, {
          id: this.rowID,
          type: this.agreeBtn,
          securities_account: this.ruleSubForm.ZhengJuanAccount,
          reason: this.ruleSubForm.fail_info,
          verification: verification,
        })
          .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            } else if (res.code == -10000) {
              this.$set(
                this.ruleSubForm,
                "ZhengJuanAccount",
                // Math.ceil(Math.random() * 1E10)
                this.MathRand()
              ); //随机生成8位数字（证券账户）
            }
          })
          .catch((error) => {
            this.$message.error(error.Error);
          });
      }
    },
    //账户升级
    accountUpgrade(){
      var _this = this;
      if (this.type == 1) {
        accountUp(this.rowID,{
          type:this.AccountBtn,
        })
        .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            }
        })
        .catch((error) => {
          this.$message.error(error.Error);
        });
      }else if(this.type == 2){
        accountUp1(this.rowID,{
          type:this.AccountBtn,
        })
        .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            }
        })
        .catch((error) => {
          this.$message.error(error.Error);
        });
      } else if (this.type == 3){
        accountUp2(this.rowID,{
          type:this.AccountBtn,
        })
        .then((res) => {
            this.submitLoading = false;
            if (res.code == 10000) {
              this.cancel();
              this.$parent.getList();
            }
        })
        .catch((error) => {
          this.$message.error(error.Error);
        });
      }
      
    },
    clickAgree() {
      this.agreeBtn = 1;
    },
    clickRejest() {
      this.agreeBtn = 2;
    },
    clickAccountTrue(){
      this.AccountBtn = 1;
    },
    clickAccountFalse(){
      this.AccountBtn = 2;
    },
    delReason(e, id) {
      e.stopPropagation();
      // 确定删除？
      this.$confirm(this.$t("common.common10"), {
        confirmButtonText: this.$t("common.common2"),
        cancelButtonText: this.$t("common.common1"),
        type: "warning",
      })
        .then(() => {
          deleteItem(id)
            .then((res) => {
              if (res.code == 10000) {
                this.getReasonList();
              }
            })
            .catch((error) => {
              this.$message.error(error.Error);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            // 已取消删除
            message: this.$t("common.common11"),
          });
        });
    },
    formShow(id, name) {
      if (!this.ruleForm.data["page_" + id]?.[name] == "") {
        return true;
      } else {
        return false;
      }
    },
    isImg(isUrl) {
      if (isUrl) {
        if (
          /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i.test(
            isUrl
          )
        ) {
          return "image";
        } else {
          return "input";
        }
      } else {
        return false;
      }
    },
    isShowRow(data, item, Bitem) {
      // list 表示 获取行容器里面name表示的那一个
      var list = Bitem.fields.find(
        (items) => items.name == item.config.keyName
      );
      // 当list存在且属于身份证类型 且data有数据时，显示row
      if (
        list &&
        list.type == "identCards" &&
        data[item.config.keyName] !== ""
      ) {
        return true;
      }
      // 当不属于身份证时，行容器 keyValue的值 和data的值存在且相等，显示row， 否则不显示
      if (
        item.config.keyValue &&
        data[item.config.keyName] &&
        item.config.keyValue == data[item.config.keyName]
      ) {
        return true;
      } else {
        return false;
      }
    },
    changeAccount() {
      this.$forceUpdate();
    },
  },
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.Bcontent,
.shenheForm {
  border: 1px solid #e7e7f0;
  border-radius: 5px;
  margin: 10px 0;
  overflow: hidden;
  padding-right: 10px;
}
h3 {
  display: inline-block;
  min-width: 130px;
  text-align: right;
  margin: 10px 0 20px 10px;
}
.el-select {
  width: 100%;
}
.checkContent {
  text-align: center;
  padding-bottom: 15px;
  .contentAdd {
    position: relative;
    overflow: hidden;
    .operBtn {
      position: absolute;
      bottom: 0;
      right: -65px;
    }
  }
  > span {
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    color: #448ef6;
  }
}
::v-deep .el-tag.el-tag--info {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>